package com.jsd.stream;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.List;

/**
 * test 123
 */
public class Test {

    public static void main(String[] args) {
        User a = new User(1, "a", 21);
        User b = new User(2, "b", 22);
        User c = new User(3, "c", 23);
        User d = new User(4, "d", 24);
        User e = new User(6, "e", 25);

        List<User> users = Arrays.asList(a, b, c, d, e);

        users.stream()
                .filter(u -> {
                    return u.getId() % 2 == 0;
                })
                .filter(u -> {
                    return u.getAge() > 23;
                })
                .map(u -> {
                    return u.getName().toUpperCase();
                })
                .sorted((u1, u2) -> {
                    return u2.compareTo(u1);
                })
                .limit(1)
                .forEach(System.out::println);

    }
}
